import Vue from 'vue'
import VueRouter from 'vue-router'

import Layout from '../page/layout'

//显示声明使用VueRouter
Vue.use(VueRouter);

export default new VueRouter({
  routes: [
    {
      //进入登录
      path: '/',
      redirect: '/login',
    },
    {
      //主要布局
      path: '/layout',
      name: 'layout',
      component: () => import('../page/layout'),
      children: [
        {
          //店铺列表
          path: '/restaurants',
          name: 'restaurants',
          component:  () => import('../page/userPage/RestaurantList')
        },
        {
          //进入店铺详情
          path: '/restaurant/:shopId/info',
          name: 'restaurantInfo',
          component: () => import('../page/userPage/RestaurantInfo'),
          props: true
        },
        {
          //进入我的收货地址
          path: '/address',
          name: 'address',
          component: () => import('../page/userPage/MyAddress')
        },
        {
          //进入我的订单
          path: '/order',
          name: 'order',
          component: () => import('../page/userPage/Order')
        },
        {
          //进入我的收藏
          path: '/collection',
          name: 'collection',
          component: () => import('../page/userPage/Collection')
        },
        {
          //进入我的账户
          path: '/reset',
          name: 'reset',
          component: () => import('../page/userPage/Reset')
        },
        {
          // 店铺加盟
          path: '/registerRest',
          name: 'registerRestaurant',
          component: () => import('../page/sellerPages/RegisterRestaurant')
        },
        {
          // 我的店铺
          path: '/myRestaurant',
          name: 'toMyRestaurant',
          component: () => import('../page/sellerPages/MyRestaurant')
        },
        {
          // 餐品管理
          path: '/foodManage',
          name: 'ManageFood',
          component: () => import('../page/sellerPages/FoodManage')
        },
        {
          // 类别管理
          path: '/cateManage',
          name: 'ManageCate',
          component: () => import('../page/sellerPages/CateManage')
        },
        {
          // 最新订单
          path: '/latestOrder',
          name: 'LatestOrder',
          component: () => import('../page/sellerPages/LatestOrder')
        },
        {
          // 已完成订单
          path: '/completeOrder',
          name: 'CompletedOrder',
          component: () => import('../page/sellerPages/CompletedOrder')
        },
        {
          // 历史订单评价
          path: '/comments',
          name: 'Comments',
          component: () => import('../page/sellerPages/Comments')
        },
      ]
    },
    {
      //进入登录
      path: '/login',
      name: 'login',
      component: () => import('../page/Login')
    },
    {
      //登出
      path: '/logout',
      name: 'logout',
      component: () => import('../page/Login')
    },
    {
      //注册
      path: '/register',
      name: 'Register',
      component: () => import('../page/Register')
    },
  ]
})
